package com.mr.service.api;

import com.b2c.common.enums.ExceptionEnums;
import com.b2c.common.exception.MrException;
import com.b2c.common.utils.PageResult;
import com.mr.service.pojo.BrandEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName BrandApi
 * @Description: TODO
 * @Author kun
 * @Date 2020/8/7
 * @Version V1.0
 *
 **/
@RequestMapping("brand")
public interface BrandApi {
    @GetMapping("page")
    public ResponseEntity<PageResult> getBrandPage(
            @RequestParam(value = "page",defaultValue = "1") Integer page,
            @RequestParam(value = "rows",defaultValue = "5") Integer rows,
            @RequestParam(value = "key" , required = false) String key,
            @RequestParam(value = "sortBy", required = false) String sortBy,
            @RequestParam(value = "desc", required = false) Boolean desc
    );

    @GetMapping("queryBrandById")
    public  BrandEntity queryBrandById(@RequestParam("id") Long id);


    @GetMapping("cid/{cid}")
    public ResponseEntity<List<BrandEntity>> queryBrandByCategory(@PathVariable("cid") Long cid);

    //品牌增加
    @PostMapping
    public ResponseEntity<Void> addBrand(BrandEntity entity, @RequestParam("cids") List<Long> cids);

    @PutMapping
    public ResponseEntity<Void> updateBrand(BrandEntity entity,@RequestParam("cids") List<Long> cids);

    @DeleteMapping
    public  ResponseEntity deleteBrand(@RequestParam(value = "bid") Long bid);
}
